package com.hebi.xzspring;

import org.apache.catalina.Context;
import org.apache.catalina.startup.Tomcat;

public class XzApplication {

	public static void run(String[] args)  {

		try {
			Tomcat tomcat = new Tomcat();
			tomcat.setPort(9002);

			System.out.println("启动内嵌tomcat...");
			tomcat.start();
//		IndexServlet indexServlet = new IndexServlet();
//
//		// addWebapp() 方法就是告诉tomcat 以web项目形式运行项目
			Context context = tomcat.addWebapp("/beat", "E:/xzTomcat/");
//
//		tomcat.addServlet("/beat","index", indexServlet);
//
//		context.addServletMappingDecoded("/index.do", "index");

			tomcat.getServer().await();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

}

